// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import App from './App';
import router from './router';
import axios from 'axios';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import '../static/font/iconfont.css'
// 引入请求/响应拦截
import './api/base.js'
// 引入echarts
// import echarts from 'echarts'
// 引入全局方法
import global from './../static/static';
Vue.config.productionTip = false;

Vue.prototype.axios = axios;
// 引入全局方法
Vue.prototype.global = global;

Vue.use(ElementUI);
// 路由拦截器
router.beforeEach((to, from, next) => {
    var toName = to.name;
    if (toName != 'index' && toName != 'login' && toName != 'loginNestOne' && toName != 'loginNestTwo' ) {
        // 判断登录状态
        if (false) {
            next({path:'/'});
            Vue.prototype.$message.closeAll();
            Vue.prototype.$message({
                showClose: true,
                message: '请先登录!'
            });
            return;
        }
    }
    next();
});
/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    components: { App },
    template: '<App/>'
})
